package com.atguigu.lease.common.context;

public class LoginUserContext {

    private static ThreadLocal<LoginUser> threadLocal = new ThreadLocal<>();

    public static void setLoginUser(Long userId, String username) {
        LoginUser loginUser = new LoginUser(userId, username);
        threadLocal.set(loginUser);
    }

    public static LoginUser getLoginUser() {
        return threadLocal.get();
    }

    public static void removeLoginUser() {
        threadLocal.remove();
    }
}
